package com.zmht.specedu.vo;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import com.zmht.specedu.frame.util.StringUtils;
/**
 * Teacher entity.
 * 
 * @author ������
 */

public class Teacher implements java.io.Serializable {

	// Fields

	private Integer teacherId;
	private String tname;
	private String sex;
	private String tbirthday;
	private Integer workTime;
	private String xueLi;
	private String position;
	private String specDirect;
	private String special;
	private String teachProcess;
	private String rongYu;
	private Integer fengongType;
	private String zeRenType;
	private String tuserName;
	private String tpassWord;
    private Fengongtype fengongtypes;
    private String fengong;

	public static final int ROLE_ADMIN = 1;
	public static final int ROLE_GENERA = 0;
	
	public static final String DUTY_TYPE_ZHUREN = "校长(主任)";
	public static final String DUTY_TYPE_FUZHUREN = "副校长(副主任)";
	public static final String DUTY_TYPE_ZHURENZHULI = "校长(主任)助理";
	public static final String DUTY_TYPE_NIANJIZHUZHANG = "年级组长";
	public static final String DUTY_TYPE_BANZHUREN = "班主任";
	public static final String DUTY_TYPE_PUTONGLAOSHI = "普通教师";
	public static Map<String,String> dutyMapping = new HashMap<String,String>();
	static{
		dutyMapping.put("1", DUTY_TYPE_ZHUREN);
		dutyMapping.put("2", DUTY_TYPE_FUZHUREN);
		dutyMapping.put("3", DUTY_TYPE_ZHURENZHULI);
		dutyMapping.put("4", DUTY_TYPE_NIANJIZHUZHANG);
		dutyMapping.put("5", DUTY_TYPE_BANZHUREN);
		dutyMapping.put("6", DUTY_TYPE_PUTONGLAOSHI);
	}
	
	/*public static final String[] DUTY_TYPES = new String[]{
		DUTY_TYPE_ZHUREN,DUTY_TYPE_FUZHUREN,DUTY_TYPE_ZHURENZHULI,DUTY_TYPE_NIANJIZHUZHANG,DUTY_TYPE_BANZHUREN,DUTY_TYPE_PUTONGLAOSHI
	};*/
	public boolean isAdmin(){
	    return getRoleType() == ROLE_ADMIN;
	}
	public int getRoleType(){
		if(StringUtils.isEmpty(getZeRenType())){
			return ROLE_GENERA;
		}
		if(getZeRenType().equals("1")
				|| getZeRenType().equals("2")
				|| getZeRenType().equals("3")){
			return ROLE_ADMIN;
		}
		return ROLE_GENERA;
	}
	
	// Constructors

	/** default constructor */
	public Teacher() {
	}

	/** minimal constructor */
	public Teacher(Integer teacherId, String tname, String sex,
			Integer fengongType, String zeRenType, String tuserName,
			String tpassWord, Fengongtype fengongtypes) {
		this.teacherId = teacherId;
		this.tname = tname;
		this.sex = sex;
		this.fengongType = fengongType;
		this.zeRenType = zeRenType;
		this.tuserName = tuserName;
		this.tpassWord = tpassWord;
		this.fengongtypes = fengongtypes;
	}

	/** full constructor */
	public Teacher(Integer teacherId, String tname, String sex,
			String tbirthday, Integer workTime, String xueLi, String position,
			String specDirect, String special, String teachProcess,
			String rongYu, Integer fengongType, String zeRenType,
			String tuserName, String tpassWord, Set classteachers, Fengongtype fengongtypes) {
		this.teacherId = teacherId;
		this.tname = tname;
		this.sex = sex;
		this.tbirthday = tbirthday;
		this.workTime = workTime;
		this.xueLi = xueLi;
		this.position = position;
		this.specDirect = specDirect;
		this.special = special;
		this.teachProcess = teachProcess;
		this.rongYu = rongYu;
		this.fengongType = fengongType;
		this.zeRenType = zeRenType;
		this.tuserName = tuserName;
		this.tpassWord = tpassWord;
		this.fengongtypes = fengongtypes;
	}

	// Property accessors

	public Integer getTeacherId() {
		return this.teacherId;
	}

	public void setTeacherId(Integer teacherId) {
		this.teacherId = teacherId;
	}

	public String getTname() {
		return this.tname;
	}

	public void setTname(String tname) {
		this.tname = tname;
	}

	public String getSex() {
		return this.sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getTbirthday() {
		return this.tbirthday;
	}

	public void setTbirthday(String tbirthday) {
		this.tbirthday = tbirthday;
	}

	public Integer getWorkTime() {
		return this.workTime;
	}

	public void setWorkTime(Integer workTime) {
		this.workTime = workTime;
	}

	public String getXueLi() {
		return this.xueLi;
	}

	public void setXueLi(String xueLi) {
		this.xueLi = xueLi;
	}

	public String getPosition() {
		return this.position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public String getSpecDirect() {
		return this.specDirect;
	}

	public void setSpecDirect(String specDirect) {
		this.specDirect = specDirect;
	}

	public String getSpecial() {
		return this.special;
	}

	public void setSpecial(String special) {
		this.special = special;
	}

	public String getTeachProcess() {
		return this.teachProcess;
	}

	public void setTeachProcess(String teachProcess) {
		this.teachProcess = teachProcess;
	}

	public String getRongYu() {
		return this.rongYu;
	}

	public void setRongYu(String rongYu) {
		this.rongYu = rongYu;
	}

	public Integer getFengongType() {
		
		return this.fengongType;
	}

	public void setFengongType(Integer fengongType) {
		this.fengongType = fengongType;
	}

	public String getZeRenType() {
		return this.zeRenType;
	}
	public String getZeRenTypeChinese(){
		return Teacher.dutyMapping.get(getZeRenType());
	}
	public void setZeRenType(String zeRenType) {
		this.zeRenType = zeRenType;
	}

	public String getTuserName() {
		return this.tuserName;
	}

	public void setTuserName(String tuserName) {
		this.tuserName = tuserName;
	}

	public String getTpassWord() {
		return this.tpassWord;
	}

	public void setTpassWord(String tpassWord) {
		this.tpassWord = tpassWord;
	}


	public Fengongtype getFengongtypes() {	
		
		return fengongtypes;
	}
	
	public void setFengongtypes(Fengongtype fengongtypes) {
		this.fengongtypes = fengongtypes;
	}

	public String getFengong() {
		return fengongtypes.getName();
	}

	public void setFengong(String fengong) {
		this.fengong = fengong;
	}

	

}